#ifndef _MESH_
#define _MESH_

#include <vector>
#include <GL/glut.h>
#include "vec3.h"
#include "matrix.h"

/* Creates a mesh that consists of:
 * a vector array for vertices,
 * a vector array for colors,
 * a vector for locations and
 * a vector for bound.
 */

class Mesh
{
public:
	//Lifecycle
	bool load(const char *path, char mirror=0);
	virtual void draw();

	//Location and Bound box
	vec3 loc, bound;

	void add(Mesh);

//protected:
	//Vertices and colors
	std::vector<vec3> v, c;
};

/* This is my experiment for a better mesh 
 * Creates a mesh which has vertices and colors.
 */
class Mesh2
{
private:
	//Buffer object
	GLuint vbo;

	//Vertices
	int vcount;
	float *vertices;
	float *colors;

public:
	//Constructor - Destructor
	Mesh2();
	~Mesh2();

	//Vertex count
	void set_vertex_count(int vcount);
	int get_vertex_count() const { return vcount; };

	//Getters to mesh data
	float *get_vertex_array() const { return vertices; };
	float *get_colors_array() const { return colors  ; };

	//Load from file
	bool load(const char *path, char mirror=0);

	//Draw
	virtual void draw() const;

	//Bound (STILL WORKING ON THIS)
	vec3 pbound, nbound;
};
#endif
